package Pet.Management.utils;

public class CaptchaUtils {
    
    /** Redis验证码key前缀 */
    private static final String CAPTCHA_CODE_KEY = "captcha_codes:";
    
    /** 验证码有效期（分钟） */
    public static final int CAPTCHA_EXPIRATION = 2;
    
    private CaptchaUtils() {
        throw new IllegalStateException("Utility class");
    }
    
    /**
     * 获取验证码的Redis key
     */
    public static String getCaptchaKey(String uuid) {
        return CAPTCHA_CODE_KEY + uuid;
    }
    
    /**
     * 验证码校验
     */
    public static boolean validateCaptcha(String code, String sessionCode) {
        if (code == null || sessionCode == null) {
            return false;
        }
        return code.equalsIgnoreCase(sessionCode);
    }
} 